public class Thread2 extends Thread {
    public volatile boolean ok = true;

    @Override
    public void run() {
        while (ok) {
            System.out.println("1");
        }
    }
}
